package com.cn.front.controller;

import com.cn.common.pojo.NewsModel;
import com.cn.common.pojo.ResultModel;
//import com.cn.front.feign.NItemFeign;
import com.cn.front.feign.NewsForHomeFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("news")
public class NewsController {
    @Autowired
    NewsForHomeFeign newsForHomeFeign;
//    @Autowired
//    NItemFeign nItemFeign;
    @RequestMapping("newsByType")
    public ResultModel newsByType(int type){
        ResultModel model = newsForHomeFeign.newsByType(type);
        return model;
    }
    @RequestMapping("nItem")
    public Map news(){
        Map map = new HashMap<>();
        map.put("Nitem",newsForHomeFeign.nitem());
        map.put("news",newsForHomeFeign.newsForNews());
        return map;
    }
    @RequestMapping("newsForId")
    public ResultModel newsForId(int id){
        return newsForHomeFeign.newsForId(id);
    }
}
